package mybatis_spring.service.impl;

import mybatis_spring.dao.UserMapper;
import mybatis_spring.service.UserService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service
public class UserServiceImpl implements UserService {

    @Resource
    UserMapper userMapper;


    @Override
    @Transactional(rollbackFor = Exception.class)
    public Object selectOne(Integer id) {
        userMapper.selectById(2);
        return userMapper.selectById(1);
    }

    @Override
    public Object selectOne1(Integer id) {
        return userMapper.selectById(1);
    }
}
